<!-- 金料库 -->
<template>
	<view class="goldWarehouse" :style="{backgroundImage:`url(${HTTP_REQUEST_URL}/unimg/goldVaultBg.png)`}">
		<!-- <view class="headerBox"></view> -->
		<view class="nav_box" :style="{'padding-top': statusBar + 'px'}">
			<view class="nav_title flex_s" :style="{'height':navBar+'px'}">
				<view class="image_box">
					<image src="@/static/imgs/logoBg.png" mode="widthFix"></image>
				</view>
			</view>
		</view>

		<!-- 		<view class="tab_box flex_se">
			<view class="tab_item" :class="tagIndex==index?`active active${index}`:''"
				v-for="(item,index) in tagList" :key="index" @click="tagIndex=index">
				{{item}}
			</view>
		</view> -->
		<!-- <view class="mainFid flex_c" @tap="$util.JumpPath('/pages/new_gold/goldWarehouse/inOutRecord')">
			出入库记录
		</view> -->
		<view class="center_box center1">
			<view class="title_box">
				<view class="title">
					金价参考上海实时金价
				</view>
				<view class="sub_title">
					{{('real-time gold price').toUpperCase()}}
				</view>
			</view>
			<view class="name_box">
				黄金回购价
			</view>
			<view class="num_box">
				<text>{{goldInfo.recycle_price||'--'}}</text>
				<view class="unit_box">
					元/克
				</view>
			</view>
			<view class="my_weight flex_fc">
				<view class="weight_title">
					我的克重/克
				</view>
				<view class="weight_num">
					{{goldInfo.gold_stock || 0}}
				</view>
				<view class="weight_price">
					预估价值:{{((goldInfo.gold_stock * goldInfo.recycle_price)||0).toFixed(2) }}元
				</view>
			</view>
		</view>
		<view class="center_box center2 flex_sb">
			<view class="listItem flex_s" v-for="(sa,idx) in inOutList" :key="idx" @click="change(idx)">
				<image :src="sa.icon" mode="widthFix"></image>
				{{sa.name}}
			</view>
		</view>
		<pageFooter></pageFooter>
	</view>
</template>

<script>
	import {
		HTTP_REQUEST_URL
	} from '@/config/app.js'
	import pageFooter from '@/components/pageFooter/index.vue'
	import {
		getMytock
	} from '@/api/new_store.js'
	export default {
		components: {
			pageFooter
		},
		data() {
			return {
				HTTP_REQUEST_URL,
				customBar: this.customBar,
				statusBar: this.statusBar,
				navBar: this.navBar || 0,
				isSticky: false, // 控制模块是否吸顶
				tagList: ['黄金', '铂金', '白银', '钯金'],
				tagIndex: 0,

				inOutList: [{
						name: '卖出',
						icon: require('@/static/imgs/list2.png')
					},
					{
						name: '提货',
						icon: require('@/static/imgs/list0.png')
					},
					{
						name: '兑换',
						icon: require('@/static/imgs/list1.png')
					}
				],
				goldInfo: {}
			}
		},
		onShow() {
			this.getMytockFc()
		},
		onPageScroll(e) {
			// 判断滚动距离是否超过状态栏高度
			this.isSticky = e.scrollTop > this.customBar ? true : false
		},
		methods: {
			getMytockFc() {
				getMytock().then(res => {
					if (res.status != 200) return
					this.goldInfo = res.data
				})
			},
			change(index) {
				if (index == 0) {
					this.$util.JumpPath('/pages/new_gold/goldWarehouse/sell')
				} else if (index == 1) {
					this.$util.JumpPath('/pages/new_gold/goldWarehouse/carryOlder')
				} else {
					uni.setStorageSync('goods_cate_index', 1)
					this.$util.JumpPath('/pages/goods_cate/goods_cate')
				}
			}
		}
	}
</script>

<style lang="scss" scoped>
	.center_box {

		width: 690rpx;
		font-size: 34rpx;
		color: #343434;
		margin: 0rpx auto;
		border-radius: 26rpx;
		background: rgba(255, 255, 255, 0.6);
		border: 2rpx solid rgba(255, 255, 255, 1);
		padding: 32rpx 26rpx 50rpx;

		.listItem {
			padding: 35rpx 50rpx;
			font-size: 30rpx;
			letter-spacing: 0rpx;
			line-height: 43.44rpx;
			color: #6E4913;
			text-align: center;
			border-radius: 16rpx;
			background: #fff;

			image {
				display: block;
				width: 33rpx;
				height: 33rpx;
				margin-right: 10rpx;
			}
		}

		.my_weight {
			width: 637rpx;
			padding: 37rpx 0 43rpx;
			margin: 0 auto;
			border-radius: 20rpx;
			background: linear-gradient(90deg, rgba(242, 226, 174, 1) 0%, rgba(249, 244, 229, 1) 47.92%, rgba(237, 222, 177, 1) 100%);
			border: 2rpx solid rgba(255, 255, 255, 1);
			box-shadow: 0rpx 2rpx 10rpx rgba(255, 255, 255, 1);

			.weight_title {
				font-size: 28rpx;
				color: #383838;
				margin-bottom: 20rpx;

			}

			.weight_num {
				font-size: 50rpx;
				color: #6E4913;
				line-height: 80rpx;
				font-weight: bold;

			}

			.weight_price {
				font-size: 24rpx;
				color: #9C7233;
			}
		}

		.title_box {

			text-align: center;
			margin-bottom: 50rpx;

			.title {
				font-weight: bold;
				font-size: 34rpx;
				color: #343434;
				margin-bottom: 10rpx;
			}

			.sub_title {
				letter-spacing: 5rpx;
				color: #8C8C8C;
				font-size: 20rpx;
			}
		}

		.name_box {
			text-align: center;
			margin-bottom: 20rpx;
		}

		.num_box {
			display: flex;
			justify-content: center;
			align-items: flex-end;
			margin-bottom: 50rpx;

			text {
				color: #D43030;
				font-size: 60rpx;
				font-weight: bold;
				margin-right: 10rpx;
				line-height: 50rpx;
			}

			.unit_box {
				height: 22rpx;
				line-height: 22rpx;
				text-align: center;
				font-size: 14rpx;
				color: #fff;
				background: #D43030;
				border-radius: 8rpx;
				padding: 0 10rpx;
				border-radius: 4rpx;
			}
		}
	}

	.goldWarehouse {
		position: relative;
		width: 100%;
		height: 100vh;
		background: rgba(222, 212, 187, 1);
		padding-bottom: 140rpx;
		overflow: hidden;
		background-size: contain;
		background-repeat: no-repeat;
	}

	.headerBox {
		z-index: 99;
		width: 750rpx;
		height: 420rpx;
		background: url(https://img.js.design/assets/img/657198f8d56168c85f2c0b13.png#36e4b8c57b6ac27058d006837a3d0844);
		background-repeat: no-repeat;
		background-position: center center;
		background-size: 100% 100%;
	}

	.nav_bar {
		z-index: 9;
		position: relative;
		position: fixed;
		top: 0;
		left: 0;
		display: flex;
		align-items: center;
		justify-content: space-around;
		width: 750rpx;
		height: 80rpx;
		padding: 0 36rpx;
		box-sizing: border-box;

		.navTiele {
			width: 100%;
			font-size: 34rpx;
			font-weight: 500;
			letter-spacing: 0rpx;
			line-height: 80rpx;
			color: rgba(48, 48, 48, 1);
			text-align: center;
		}

	}

	.nav_bar_bg {
		background: #fff;
	}

	.headBarBox {
		z-index: 1000;
		width: 700rpx;
		height: 103rpx;
		border-radius: 13rpx 13rpx 0 0;
		background: rgba(213, 189, 145, 1);
		margin: -200rpx auto 0;

		.barItem {
			width: 25%;
			font-size: 32rpx;
			font-weight: 500;
			letter-spacing: 0rpx;
			line-height: 46.34rpx;
			color: rgba(255, 255, 255, 1);
			text-align: center;
			vertical-align: top;
		}

		.barItemActive {
			height: 120rpx;
			margin-top: -40rpx;
			background: #fff;
			font-size: 32rpx;
			font-weight: 550;
			letter-spacing: 0rpx;
			line-height: 100rpx;
			color: rgba(61, 61, 61, 1);
			text-align: center;
			border-radius: 40rpx 40rpx 0 0;

		}
	}

	.tab_box {
		width: 700rpx;
		height: 87rpx;
		border-radius: 24rpx 24rpx 0rpx 0rpx;
		background: #F7F0E8;
		color: #78532A;
		font-size: 30rpx;
		margin: -200rpx auto 0;

		.tab_item.active {
			height: 100rpx;
			line-height: 100rpx;
			background: #FDFBF4;
			font-weight: bold;
			margin-top: -24rpx;

			&::after {
				position: absolute;
				content: "";
				width: 60rpx;
				height: 60rpx;
				right: -60rpx;
				bottom: 0;
			}

			&::before {
				position: absolute;
				content: "";
				width: 60rpx;
				height: 60rpx;
				bottom: 0;
				left: -60rpx;
			}
		}

		.active0 {
			border-radius: 24rpx 24rpx 0 0;

			&::after {
				background: radial-gradient(circle at 60rpx 0, transparent 60rpx, #FDFBF4 60rpx);
			}
		}

		.active1 {
			border-radius: 24rpx 24rpx 0 0;

			&::after {

				background: radial-gradient(circle at 60rpx 0, transparent 60rpx, #FDFBF4 60rpx);
			}

			&::before {
				background: radial-gradient(circle at 0 0, transparent 60rpx, #FDFBF4 60rpx);
			}
		}

		.active2 {
			border-radius: 24rpx 24rpx 0 0;

			&::after {

				background: radial-gradient(circle at 60rpx 0, transparent 60rpx, #FDFBF4 60rpx);
			}

			&::before {
				background: radial-gradient(circle at 0 0, transparent 60rpx, #FDFBF4 60rpx);
			}
		}

		.active3 {
			border-radius: 24rpx 0 0 0;

			&::before {
				background: radial-gradient(circle at 0 0, transparent 60rpx, #FDFBF4 60rpx);
			}
		}

		.tab_item {
			position: relative;
			width: 33.33%;
			text-align: center;
			line-height: 87rpx;
		}
	}

	.content {
		width: 702rpx;
		height: 968rpx;
		border-radius: 13rpx;
		background: rgba(253, 251, 244, 1);
		margin: -10rpx auto 0;

		.contentTop {
			display: flex;
			align-items: center;
			justify-content: space-around;
			padding-top: 36rpx;



			.contentTopItem {
				position: relative;
				width: 50%;
				font-size: 28rpx;
				font-weight: 550;
				color: rgba(61, 61, 61, 1);
				text-align: center;

				.redTxt {
					color: #d43030;
					font-size: 48rpx;
					font-weight: 700;
				}
			}

			.contentTopItem:first-of-type::before {
				content: '';
				position: absolute;
				right: 0;
				top: 0;
				width: 2rpx;
				height: 79rpx;
				background: rgba(207, 170, 112, 1);
			}

		}

		.main {
			position: relative;
			width: 640rpx;
			height: 483rpx;
			border-radius: 22rpx;
			background: rgba(255, 255, 255, 1);
			margin: 24rpx auto 0;
			overflow: hidden;



			.unitPrice {
				font-size: 66rpx;
				font-weight: 700;
				letter-spacing: 0rpx;
				line-height: 95.57rpx;
				color: rgba(212, 48, 48, 1);
				margin: 176rpx auto 70rpx;
				text-align: center;

				.geryTxt {
					font-size: 28rpx;
					font-weight: 400;
					letter-spacing: 0rpx;
					line-height: 40.54rpx;
					color: rgba(56, 56, 56, 1);
				}

			}

			.tipsTxt {
				font-size: 66rpx;
				font-weight: 700;
				letter-spacing: 0rpx;
				line-height: 95.57rpx;
				color: rgba(166, 166, 166, 0.2);
				text-align: center;
				vertical-align: top;
				margin: 176rpx auto 59rpx;
			}

			.estimate {
				width: 538rpx;
				height: 64rpx;
				font-size: 30rpx;
				line-height: 64rpx;
				text-align: center;
				color: rgba(125, 73, 16, 0.7);
				background: rgba(247, 234, 198, 0.2);
				border: 1rpx solid rgba(233, 207, 166, 1);
				border-radius: 32rpx;
				margin: 0 auto;
			}

		}

		.inoutBox {
			padding: 65rpx 24rpx 0;

			.listItem {
				width: 200rpx;
				height: 184rpx;
				font-size: 30rpx;
				letter-spacing: 0rpx;
				line-height: 43.44rpx;
				color: rgba(61, 61, 61, 1);
				text-align: center;
				border-radius: 12rpx;
				background: rgba(213, 189, 145, 0.4);

				image {
					display: block;
					width: 58.87rpx;
					height: 58.88rpx;
					margin: 31rpx auto 18rpx;
				}
			}
		}

	}

	.mainFid {
		position: absolute;
		top: 350rpx;
		right: 0;
		width: 250rpx;
		height: 55rpx;
		font-size: 28rpx;
		color: rgba(51, 41, 21, 1);
		border-radius: 33.5rpx 0rpx 0rpx 33.5rpx;
		background: linear-gradient(90deg, #E1C498 0%, #FAEEDE 46.53%, #F2E3C6 100%);
	}

	.center1 {
		margin-top: 450rpx;
	}

	.center2 {
		margin-top: 35rpx;
	}

	.border_bm {
		border-bottom: 2rpx solid #F8F8FA;
	}
</style>